//
//  JXScrollBar.h
//  页面切换
//
//  Created by 尹桥印 on 14/12/19.
//  Copyright (c) 2014年 北京娇羞科技有限公司. All rights reserved.
//

#import <UIKit/UIKit.h>

typedef NS_ENUM(NSInteger, JXScrollBarSplitType) {
    JXScrollBarSplitTypeDefault = 0, //默认的效果，button的宽度与文字关联，底部lable与button的文字宽度一样。
    JXScrollBarSplitTypeAverage = 1, //根据自身view(JXScrollbar)大小，将button的宽度平均分配在自身view上，lable的宽度与button的宽度一样
    JXScrollBarSplitTypeCenter = 2//scrollBar根据内容居中显示
};

@class JXScrollBar;

@protocol JXScrollBarDelegate <NSObject>

@optional
- (void)titleClicked:(JXScrollBar *)scrollbar index:(int)index;
@end

@interface JXScrollBar : UIView
@property (nonatomic, weak) NSArray *titleArray;

@property (nonatomic,assign) JXScrollBarSplitType type;

@property (nonatomic, weak) id<JXScrollBarDelegate> delegate;
-(instancetype)initWithFrame:(CGRect)frame type:(JXScrollBarSplitType)type;
-(instancetype)initWithTitleArray:(NSArray *)titleArray frame:(CGRect)frame;
-(instancetype)initWithTitleArray:(NSArray *)titleArray frame:(CGRect)frame type:(JXScrollBarSplitType)type;
- (void)scrollViewDidScroll:(UIScrollView *)scrollView;
-(void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView;
-(void)autoScrollToCenter:(int)pageNum;
@end
